public class ChargingPlanDictionaryModel extends Object implements XMLMarshallable
The XML APIs specify the following XSD fragment:
XSD Fragment
<xs:element name="chargingPlanDictionary">
<xs:complexType>
<xs:sequence>
<xs:choice>
<xs:element ref="dictionaryComponent" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="typedDictionaryComponent" minOccurs="0" maxOccurs="unbounded"/>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element><xs:element name="dictionaryComponent">
<xs:complexType>
<xs:attribute name="internalChargingReference" type="xs:string" use="required"/>
<xs:attribute name="backupChargingReference" type="xs:string" default="_default_charging_reference_"/>
</xs:complexType>
</xs:element><xs:element name="typedDictionaryComponent">
<xs:complexType>
<xs:attribute name="internalChargingReference" type="xs:string" use="required"/>
<xs:attribute name="chargingReferenceType" type="AccountType" use="required"/>
</xs:complexType>
</xs:element>
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_CHARGING_REFERENCE
This string represents the default charging reference in the dictionary.
|
| Constructor and Description |
|---|
ChargingPlanDictionaryModel()
Create an empty dictionary.
|
ChargingPlanDictionaryModel(LinkedHashMap<String,Object> dictionary,
boolean dictionaryTyped) |
| Modifier and Type | Method and Description |
|---|---|
void |
addAllReferencesFrom(ChargingPlanDictionaryModel other)
Adds all charging references of the given dictionary in the current dictionary.
|
void |
addBackupChargingReference(String internal,
String backup)
Adds a backup charging reference to the internal charging reference.
|
void |
addCharacterData(String cData)
Adds character data to the content element.
|
void |
addChargingReferenceType(String internal,
ChargingPlanAccountType type)
Adds a charging reference type to the internal charging reference.
|
void |
addChild(String tagName,
XMLMarshallable child)
Adds a child to the object, the
child representing
the marshallable object which must be added to the element. |
Object |
clone() |
String |
getBackupChargingReference(String internal)
Return the backup charging reference corresponding to the internal charging reference.
|
ChargingPlanAccountType |
getChargingReferenceType(String internal)
Return the account type of the charging reference corresponding to the internal charging reference.
|
HashMap<String,Object> |
getDictionary()
Returns the HashMap representing the dictionary
|
Iterator<String> |
getInternalChargingReferences()
Gets a iteration of all internal charging references of the dictionary.
|
String |
hasCycle()
Cycle detection in the dictionary.
|
String |
hasCycleFrom(String internal)
Cycle detection in the dictionary starting from a internal charging reference.
|
boolean |
isDictionaryTyped()
Returns true if the charging references in the dictionary are typed.
|
void |
marshal(XMLOutputter output)
Gives an XML representation of this object, including its children.
|
void |
removeInternalChargingReference(String internal)
Removes the internal charging reference and shifts all the corresponding backup references
to default charging reference.
|
void |
replaceChargingReferenceType(String internal,
ChargingPlanAccountType oldType,
ChargingPlanAccountType newType)
Replace a account type of the charging reference by another one.
|
void |
replaceInternalChargingReference(String oldInternal,
String newInternal)
Replace an internal charging reference by another one.
|
void |
setAttributes(XMLAttributes atts)
Sets the attributes of the XML representation of the element being
processed.
|
void |
setDictionaryTyped(boolean dictionaryTyped) |
int |
size()
Returns the number charging references in the dictionary.
|
public static final String DEFAULT_CHARGING_REFERENCE
public ChargingPlanDictionaryModel()
public ChargingPlanDictionaryModel(LinkedHashMap<String,Object> dictionary, boolean dictionaryTyped)
public Iterator<String> getInternalChargingReferences()
public void replaceInternalChargingReference(String oldInternal, String newInternal)
oldInternal - the reference to replace.newInternal - the new reference.NullPointerException - is thrown in the twice following cases:
public void removeInternalChargingReference(String internal)
internal - the internal charging reference.NullPointerException - is thrown when the parameter "internal" is null.public ChargingPlanAccountType getChargingReferenceType(String internal)
internal - the internal charging reference for which, we want the corresponding account type.public void addChargingReferenceType(String internal, ChargingPlanAccountType type)
internal - the internal charging reference.type - the internal charging reference type.NullPointerException - is thrown in the twice following cases:
public void replaceChargingReferenceType(String internal, ChargingPlanAccountType oldType, ChargingPlanAccountType newType)
oldType - the reference type to replace.newType - the new reference type.NullPointerException - is thrown in the twice following cases:
public String getBackupChargingReference(String internal)
internal - the internal charging reference for which, we want the corresponding backup.public void addBackupChargingReference(String internal, String backup)
The backup charging reference has to be already present in the dictionary and the internal charging reference has to be a new one in the dictionary.
internal - the internal charging reference.backup - the backup charging reference corresponding to the internal charging reference.NullPointerException - is thrown in the twice following cases:
IllegalArgumentException - is thrown in the twice following cases:
public void addAllReferencesFrom(ChargingPlanDictionaryModel other)
other - The dictionary from which we get the charging references.public int size()
public HashMap<String,Object> getDictionary()
public void setDictionaryTyped(boolean dictionaryTyped)
public boolean isDictionaryTyped()
public String hasCycleFrom(String internal)
internal - the internal charging reference of the start.public String hasCycle()
public void setAttributes(XMLAttributes atts)
XMLMarshallablesetAttributes in interface XMLMarshallableatts - The XML attributes of the current elementpublic void addChild(String tagName, XMLMarshallable child)
XMLMarshallablechild representing
the marshallable object which must be added to the element.addChild in interface XMLMarshallabletagName - The name of tag for the childchild - The child to be addedpublic void addCharacterData(String cData)
XMLMarshallableaddCharacterData in interface XMLMarshallablecData - The character data to be addedpublic void marshal(XMLOutputter output)
XMLMarshallablemarshal in interface XMLMarshallableoutput - The XML output to marshal the object intopublic Object clone() throws CloneNotSupportedException
clone in class ObjectCloneNotSupportedException